//mockjs模拟数据服务器
import Mock from 'mockjs';
import { mock as api } from '@/api/index';
//设置每次响应时间
Mock.setup({
    timeout: '200-600'
});
const urls = [].concat(
    require('./access').default,
    require('./system').default,
    require('./user').default,
    require('./oppeinCaseBase').default,
    require('./boutiqueManage').default,
    require('./houseTypeBase').default,


);

urls.forEach(function(v, k) {
    if (! v.rurl) { //查看错误的mock
        console.log("error mork index " + `mock[${k}] url lost: ${v.name}`, v);
    } else {
        v.rtype ?
            Mock.mock(v.rurl, v.rtype, v.template) :
            Mock.mock(v.rurl, v.template);
    }
});
//查看缺少mock数据的api
// for (let v in api) {
//     for (let item in api[v]) {
//         if(!urls.find(one=>one.rurl===api[v][item]))
//             //console.log(`mock data lost: api.${v}.${item}`);
//     }
// }
export default Mock;
